package com.smartao.core.mvc;

/**
 * 请求结果状态类
 * 用来标志当前请求从数据/业务角度是否成功；
 * 成功则置success为true，否则为false；message用来提示是否成功，或失败的原因；
 * @author sunxing
 *
 */
public class ResultStatus {
	// 两个快捷方式
	public static final ResultStatus SUCCESS = new ResultStatus(true);
	public static final ResultStatus FAILURE = new ResultStatus(false);
	private boolean success;
	private String message;
	
	public ResultStatus(){}
	
	public ResultStatus(boolean success, String message){
		this.success = success;
		this.message = message;
	}
	
	public ResultStatus(boolean success){
		this.success = success;
		if(success){
			this.message = "操作成功.";
		}
		else{
			this.message = "操作失败.";
		}
	}
	
	public ResultStatus(String message){
		this.success = true;
		this.message = message;
	}
	
	public boolean isSuccess() {
		return success;
	}
	public void setSuccess(boolean success) {
		this.success = success;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	
}
